home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  6.9 KB  |  176 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __QUICKDRAWTEXT__
  18. #define __QUICKDRAWTEXT__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. #if GENERATINGPOWERPC
  31. #pragma options align=mac68k
  32. #endif
  33.  
  34. #ifdef __CFM68K__
  35. #pragma lib_export on
  36. #endif
  37.  
  38.  
  39. enum {
  40. /* CharToPixel directions */
  41.     leftCaret                    = 0,                            /*Place caret for left block*/
  42.     rightCaret                    = -1,                            /*Place caret for right block*/
  43.     hilite                        = 1,                            /*Direction is SysDirection*/
  44.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  45.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  46.     smHilite                    = 1,                            /*Direction is TESysJust - obsolete */
  47. /*Constants for styleRunPosition argument in PortionLine, DrawJustified,
  48.  MeasureJustified, CharToPixel, and PixelToChar.*/
  49.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  50.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  51.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  52.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this 
  53.  is neither the leftmost nor the rightmost. */
  54.     smOnlyStyleRun                = 0,                            /* obsolete */
  55.     smLeftStyleRun                = 1,                            /* obsolete */
  56.     smRightStyleRun                = 2,                            /* obsolete */
  57.     smMiddleStyleRun            = 3                                /* obsolete */
  58. };
  59.  
  60. /* type for styleRunPosition parameter in PixelToChar etc. */
  61. typedef short JustStyleCode;
  62.  
  63. struct FontInfo {
  64.     short                            ascent;
  65.     short                            descent;
  66.     short                            widMax;
  67.     short                            leading;
  68. };
  69. typedef struct FontInfo FontInfo;
  70.  
  71. typedef short FormatOrder[1];
  72.  
  73. typedef FormatOrder *FormatOrderPtr;
  74.  
  75. typedef short FormatStatus;
  76.  
  77. struct OffPair {
  78.     short                            offFirst;
  79.     short                            offSecond;
  80. };
  81. typedef struct OffPair OffPair;
  82.  
  83. typedef OffPair OffsetTable[3];
  84.  
  85. extern pascal short Pixel2Char(Ptr textBuf, short textLen, short slop, short pixelWidth, Boolean *leadingEdge)
  86.  FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  87. extern pascal short Char2Pixel(Ptr textBuf, short textLen, short slop, short offset, short direction)
  88.  FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  89. extern pascal short PixelToChar(Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth, Boolean *leadingEdge, Fixed *widthRemaining, JustStyleCode styleRunPosition, Point numer, Point denom)
  90.  FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  91. extern pascal short CharToPixel(Ptr textBuf, long textLength, Fixed slop, long offset, short direction, JustStyleCode styleRunPosition, Point numer, Point denom)
  92.  FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  93. extern pascal void DrawJustified(Ptr textPtr, long textLength, Fixed slop, JustStyleCode styleRunPosition, Point numer, Point denom)
  94.  FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  95. extern pascal void MeasureJustified(Ptr textPtr, long textLength, Fixed slop, Ptr charLocs, JustStyleCode styleRunPosition, Point numer, Point denom)
  96.  FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  97. extern pascal Fixed PortionLine(Ptr textPtr, long textLen, JustStyleCode styleRunPosition, Point numer, Point denom)
  98.  FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  99. extern pascal void HiliteText(Ptr textPtr, short textLength, short firstOffset, short secondOffset, OffsetTable offsets)
  100.  FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  101. extern pascal void DrawJust(Ptr textPtr, short textLength, short slop)
  102.  FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  103. extern pascal void MeasureJust(Ptr textPtr, short textLength, short slop, Ptr charLocs)
  104.  FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  105. extern pascal Fixed PortionText(Ptr textPtr, long textLength)
  106.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  107. extern pascal long VisibleLength(Ptr textPtr, long textLength)
  108.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  109. extern pascal void GetFormatOrder(FormatOrderPtr ordering, short firstFormat, short lastFormat, Boolean lineRight, Ptr rlDirProc, Ptr dirParam)
  110.  FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  111. extern pascal void TextFont(short font)
  112.  ONEWORDINLINE(0xA887);
  113. extern pascal void TextFace(short face)
  114.  ONEWORDINLINE(0xA888);
  115. extern pascal void TextMode(short mode)
  116.  ONEWORDINLINE(0xA889);
  117. extern pascal void TextSize(short size)
  118.  ONEWORDINLINE(0xA88A);
  119. extern pascal void SpaceExtra(Fixed extra)
  120.  ONEWORDINLINE(0xA88E);
  121. extern pascal void DrawChar(short ch)
  122.  ONEWORDINLINE(0xA883);
  123. extern pascal void DrawString(ConstStr255Param s)
  124.  ONEWORDINLINE(0xA884);
  125. extern pascal void DrawText(const void *textBuf, short firstByte, short byteCount)
  126.  ONEWORDINLINE(0xA885);
  127. extern pascal short CharWidth(short ch)
  128.  ONEWORDINLINE(0xA88D);
  129. extern pascal short StringWidth(ConstStr255Param s)
  130.  ONEWORDINLINE(0xA88C);
  131. extern pascal short TextWidth(const void *textBuf, short firstByte, short byteCount)
  132.  ONEWORDINLINE(0xA886);
  133. extern pascal void MeasureText(short count, const void *textAddr, void *charLocs)
  134.  ONEWORDINLINE(0xA837);
  135. extern pascal void GetFontInfo(FontInfo *info)
  136.  ONEWORDINLINE(0xA88B);
  137. extern pascal void CharExtra(Fixed extra)
  138.  ONEWORDINLINE(0xAA23);
  139. extern pascal void StdText(short count, const void *textAddr, Point numer, Point denom)
  140.  ONEWORDINLINE(0xA882);
  141. extern pascal short StdTxMeas(short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info)
  142.  ONEWORDINLINE(0xA8ED);
  143. #if CGLUESUPPORTED
  144. extern void drawstring(const char *s);
  145. extern short stringwidth(const char *s);
  146. extern void stdtext(short count, const void *textAddr, const Point *numer, const Point *denom);
  147. #endif
  148. #if OLDROUTINENAMES
  149. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom)  \
  150.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining,  \
  151.     styleRunPosition, numer, denom)
  152. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)  \
  153.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition,  \
  154.     numer, denom)
  155. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom)  \
  156.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  157. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)  \
  158.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  159. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)  \
  160.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  161. #endif
  162.  
  163. #ifdef __CFM68K__
  164. #pragma lib_export off
  165. #endif
  166.  
  167. #if GENERATINGPOWERPC
  168. #pragma options align=reset
  169. #endif
  170.  
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175. #endif /* __QUICKDRAWTEXT__ */
  176.